#include <stdbool.h>
#include <string.h>

bool repeatedSubstringPattern(char* s) {
    int len = strlen(s);
    
    // 外层循环：尝试所有可能的子串长度
    for (int subLen = 1; subLen <= len / 2; subLen++) {
        // 如果字符串长度不能被子串长度整除，跳过
        if (len % subLen != 0) continue;
        
        bool isRepeated = true;
        
        // 内层循环：检查每个子串
        for (int i = subLen; i < len; i++) {
            if (s[i] != s[i % subLen]) {
                isRepeated = false;
                break;
            }
        }
        
        if (isRepeated) return true;
    }
    
    return false;
}